<?php $this->pageTitle=Yii::app()->name . ' - '.UserModule::t("Profile");
$this->breadcrumbs=array(
	UserModule::t("Profile")=>array('profile'),
	UserModule::t("Edit"),
);
?>

<div class="left-side">
    <div class="gallery"><?php  echo CHtml::link(CHtml::image($avatarThumbnail),$avatar )?>
    </div>
    <ul class="profile-actions">
    <?php if(UserModule::isAdmin()) : ?>
    <li><?php echo CHtml::link(UserModule::t('Quản trị'),array('/admin')); ?></li>
    <?php endif; ?>
    <?php if(UserModule::isDistributor()) : ?>
    <li><?php echo CHtml::link(UserModule::t('Quản trị'),array('/distributor')); ?></li>
    <?php endif; ?>
    <?php if(UserModule::isTransporter()) : ?>
    <li><?php echo CHtml::link(UserModule::t('Quản trị'),array('/transporter')); ?></li>
    <?php endif; ?>
    <?php if(UserModule::isSupplier()) : ?>
    <li><?php echo CHtml::link(UserModule::t('Quản trị'),array('/supplier')); ?></li>
    <?php endif; ?>
    <li><?php echo CHtml::link(UserModule::t('Thay đổi ảnh đại diện'),array('changeAvatar')); ?></li>
    <li><?php echo CHtml::link(UserModule::t('Thông tin cá nhân'),array('/user/profile')); ?></li>
    <li><?php echo CHtml::link(UserModule::t('Thay đổi thông tin'),array('edit')); ?></li>
    <li><?php echo CHtml::link(UserModule::t('Đổi mật khẩu'),array('changepassword')); ?></li>
    <li><?php echo CHtml::link(UserModule::t('Đăng xuất'),array('/user/logout')); ?></li>
    
    </ul>
    
</div>
<div class="right-side">
<h2><?php echo UserModule::t('Edit profile'); ?></h2>

<?php if(Yii::app()->user->hasFlash('profileMessage')): ?>
<div class="success">
<?php echo Yii::app()->user->getFlash('profileMessage'); ?>
</div>
<?php endif; ?>
<div class="form">
<?php $form=$this->beginWidget('UActiveForm', array(
	'id'=>'profile-form',
	'enableAjaxValidation'=>true,
	'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

	<?php echo $form->errorSummary($model); ?>


	<?php if(!Yii::app()->getModule('user')->isDefaultUser()): ?>
        <div class="row">
        <label for="RegistrationForm_full_name" class="required"><?php echo 'Tên công ty'; ?><span class="required">*</span></label>
	
	<?php echo CHtml::activeTextArea($model,'full_name',array('class'=>'full-name')); ?>
	<?php echo CHtml::error($model,'full_name'); ?>
	</div>
        <div class="row">
		<?php echo CHtml::activeLabelEx($model,'email'); ?>
		<?php echo CHtml::activeTextField($model,'email',array('size'=>60,'maxlength'=>128)); ?>
		<?php echo CHtml::error($model,'email'); ?>
	</div>
        <?php endif; ?>

	<div class="row">
		<?php echo CHtml::activeLabelEx($model,'username'); ?>
		<?php echo CHtml::activeTextField($model,'username',array('size'=>20,'maxlength'=>20)); ?>
		<?php echo CHtml::error($model,'username'); ?>
	</div>
            
	<div class="row">
		<?php echo CHtml::activeLabelEx($model,'phone'); ?>
		<?php echo CHtml::activeTextField($model,'phone',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo CHtml::error($model,'phone'); ?>
	</div>

	<div class="row">
		<?php echo CHtml::activeLabelEx($model,'mobile'); ?>
		<?php echo CHtml::activeTextField($model,'mobile',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo CHtml::error($model,'mobile'); ?>
	</div>

        <div class="row">
		<?php echo CHtml::activeLabelEx($model,'web'); ?>
		<?php echo CHtml::activeTextField($model,'web'); ?>
		<?php echo CHtml::error($model,'web'); ?>
	</div>
        <?php if(Yii::app()->getModule('user')->isDefaultUser()): ?>
        <div class="row">
		<?php echo CHtml::activeLabelEx($model,'birthday'); ?>
		<?php echo CHtml::activeTextField($model,'birthday'); ?>
		<?php echo CHtml::error($model,'birthday'); ?>
	</div>
        <div class="row">
		<?php echo CHtml::activeLabelEx($model,'gender'); ?>
		<?php echo CHtml::activeDropDownList($model,'gender',User::itemAlias('UserGender')); ?>
		<?php echo CHtml::error($model,'gender'); ?>
	</div>
        <?php endif; ?>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
</div>